package compiler.IR;

import compiler.PrettyPrinter;

public class MJIfElse extends MJStatement {

	private MJExpression ea;
	private MJBlock ba;
	private MJBlock bb = null;
	
	
	public MJIfElse(MJExpression ea, MJBlock ba) {
		this.ea = ea;
		this.ba = ba;
		
	}

	public MJIfElse(MJExpression ea, MJBlock ba, MJBlock bb) {
		this.ea = ea;
		this.ba = ba;
		this.bb = bb;
		
	}

	public MJExpression getEa() {
		return ea;
	}

	public void setEa(MJExpression ea) {
		this.ea = ea;
	}

	public MJBlock getBa() {
		return ba;
	}

	public void setBa(MJBlock ba) {
		this.ba = ba;
	}

	public MJBlock getBb() {
		return bb;
	}

	public void setBb(MJBlock bb) {
		this.bb = bb;
	}

	public void prettyPrint(PrettyPrinter prepri) {
		prepri.print("if(");
		this.ea.prettyPrint(prepri);
		prepri.print(")");
		this.ba.prettyPrint(prepri);
		if(bb != null){
			prepri.print("else");
			this.bb.prettyPrint(prepri);
		}
		
	}	
		
}
